<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page session="false" %>

<script>
$(document).ready( function() {
	if("${type}" == "notice_event") {
		$("#notice_gnb").removeClass("on");
		$("#event_gnb").addClass("on");
	} else {
		$("#notice_gnb").addClass("on");
		$("#event_gnb").removeClass("on");
	}
});

//Paging
function pageselectCallback(page_index, jq){
  // Get number of elements per pagionation page from form
  var items_per_page = "10";	//한페이지당 보일갯수
  var max_elem = Math.min((page_index+1) * items_per_page, ${tot_cnt});		//마지막 전체갯수
  if('${current_page}' != page_index) {	//현재페이지와 같지 않으면 페이지
  		$("#current_page").val(page_index);
  		$("#max_elem").val(max_elem);
 		$("#frmPaging").submit();
  }
  
  return false;
}

$(document).ready(function(){
  // Create pagination element with options from form
  $("#Pagination").pagination(${tot_cnt}, {		//첫번째 숫자 전체 갯수
     	items_per_page:10,	//한페이지당 표시갯수
     	num_display_entries:5,
     	num_edge_entries:1,
     	prev_text:'Prev',
     	next_text:'Next',
     	current_page:${current_page},
     	callback:pageselectCallback
  });
});
</script>

<form name="frmPaging" id="frmPaging" method="post" action="/vhmall/${type}.vh">
	<input type="hidden" name="current_page" id="current_page" value="${current_page}" />
	<input type="hidden" name="max_elem" id="max_elem" value="${max_elem}" />
</form>
	<!-- 콘텐츠 영역 -->
	<div id="BodyWrap">
        <section>
            <h4 class="pag_title">공지사항</h4>
            <div class="tabmenu_area">
                    <ul class="tab_menu1 m_wi2">
                        <li class="on" id="notice_gnb"><a href="/vhmall/notice.vh" title="공지사항">공지사항</a></li><!--
                     --><li class="on" id="event_gnb"><a href="/vhmall/notice_event.vh" title="이벤트 당첨자 발표">이벤트 당첨자 발표</a></li>
                    </ul>
                </div>
            <div id="ContentWrap4">
            	<dl class="notice_list">
           			<c:forEach items="${requestScope.noticeList }" var="items" varStatus="status">
	                	<dt>
	                    	<div class="noti_jon">${items.BOARDCATEGORY}</div>
	                        <div class="noti_tit"><c:choose><c:when test="${ items.type == 'notice_event' }">[이벤트]</c:when></c:choose>
	                        	${items.BOARDTITLE}
	                            <p>${items.CREATEDON}</p>
	                        </div>
	                    </dt>
	                    <dd>
	                    	<div class="noti_contx">${items.BOARDDESC_ENC}</div>
	                    </dd>
	                </c:forEach>
                </dl>
                <dl><div id="Pagination" class="pagination"></div></dl>
            </div>
        </section>
        <!--// 콘텐츠 영역 -->